package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeCapabilityLabelDTO;
import cn.jobstart.dto.ResumeCapabilityLabelPageDTO;
import cn.jobstart.modelExt.ResumeCapabilityLabelExt;
import cn.jobstart.searchExt.ResumeCapabilityLabelSearchExt;
import cn.jobstart.service.IResumeCapabilityLabelService;
import cn.jobstart.vo.ResumeCapabilityLabelDetailVO;
import cn.jobstart.vo.ResumeCapabilityLabelListVO;
import cn.jobstart.vo.ResumeCapabilityLabelDomainVO;
import cn.jobstart.vo.ResumeCapabilityLabelDetailDomainVO;
import cn.jobstart.export.ResumeCapabilityLabelDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeCapabilityLabelController      简历能力标签
*/
@Api(tags = "人才管理系统-简历能力标签相关", description = "简历能力标签相关接口")
@RestController(value ="resumeCapabilityLabelRestfulController")
@RequestMapping("/resumeCapabilityLabel/")
@Validated
public class ResumeCapabilityLabelController extends ApiManageController<ResumeCapabilityLabelDTO,ResumeCapabilityLabelPageDTO,ResumeCapabilityLabelExt, ResumeCapabilityLabelSearchExt,ResumeCapabilityLabelDomainVO,ResumeCapabilityLabelDetailDomainVO,ResumeCapabilityLabelDetailVO,ResumeCapabilityLabelListVO,String> {

	@Resource(name = "resumeCapabilityLabelService")
	private IResumeCapabilityLabelService resumeCapabilityLabelService;


	@Resource
	private IResumeEsService resumeEsService;


	@Override
	public void afterPostAdd(ResumeCapabilityLabelDTO dto, ResumeCapabilityLabelExt domain, ResumeCapabilityLabelDetailVO resumeCapabilityLabelDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeCapabilityLabelDetailVO, request, session);
		resumeEsService.publishResumeCapabilityLabelByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeCapabilityLabelDTO dto, ResumeCapabilityLabelExt domain, SkJsonResult<ResumeCapabilityLabelDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeCapabilityLabelByResumeId(domain.getResumesId());
	}

	@Override
	public IBaseService<ResumeCapabilityLabelExt, ResumeCapabilityLabelSearchExt,String> getBaseService() throws SkException {
		return resumeCapabilityLabelService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeCapabilityLabel/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "简历能力标签";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeCapabilityLabelDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_capability_label.rcl_id) as countNum");
		return totalMapSet;
	}


}